﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Trucker.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <!--#include virtual="include/Head.ascx"-->
    <script type="text/javascript" language="javascript">
        function doDelete(strID, strName) {
            if (confirm('Bạn có thực sự muốn xóa ' + strName + '?')) {
                var vnpage = getUrlVars()['page_number'];
                var vChar = getUrlVars()['letter'];
                var strHref = "";
                if (vnpage)
                    strHref = "Trucker.aspx?action=delete&ID=" + strID + "&page_number=" + vnpage;
                else
                    strHref = "Trucker.aspx?action=delete&ID=" + strID;

                if (vChar)
                    window.location.href = strHref + "&letter=" + vChar;
                else
                    window.location.href = strHref;
            }
        }
        function doSynData(strID, strName) {
            if (confirm('Đồng bộ dữ liệu bảng giá cho trucker ' + strName + '?')) {
                var vnpage = getUrlVars()['page_number'];
                var vChar = getUrlVars()['letter'];
                var strHref = "";

                if (vnpage)
                    strHref = "Trucker.aspx?action=syndata&ID=" + strID + "&page_number=" + vnpage;
                else
                    strHref = "Trucker.aspx?action=syndata&ID=" + strID;
                if (vChar)
                    window.location.href = strHref + "&letter=" + vChar;
                else
                    window.location.href = strHref;
            }
        }
        function getUrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
    </script>
</head>
<body>
    <div id="body-wrapper">
        <div id="header">
            <!--#include virtual="include/top.ascx"-->
        </div>
        <div id="main-content1">
            <h2>
            </h2>
            <div class="clear">
            </div>
            <div class="content-box" style="width: 100%;">
                <form id="frmEdit" runat="server" autocomplete="off">
                <%      
                        if (nPermissions >= 3)
                        {%>
                <div class="content-box-header">
                    <h3 style="cursor: s-resize;">
                        TRUCKER: Add [Edit]
                    </h3>
                    <div class="clear">
                    </div>
                </div>
                <table class="adminedit" style="width: 100%;">
                    <tr style="background: #CCC;">
                        <th align="left">
                            Biz Name
                        </th>
                        <th align="center">
                            Location
                        </th>
                        <th align="left">
                            Full Name
                        </th>
                        <th align="left">
                            Invoicing Name
                        </th>
                        <th align="left">
                            Add
                        </th>
                        <th align="left">
                            MST
                        </th>
                        <th align="left">
                            Note
                        </th>
                    </tr>
                    <tr>
                        <td width="150px">
                            <asp:TextBox class="cls" ID="txtBizName" runat="server" Width="98%"></asp:TextBox>
                        </td>
                        <td width="150px">
                            <asp:DropDownList class="cls" ID="ddLocation" runat="server">
                            </asp:DropDownList>
                        </td>
                        <td width="150px">
                            <asp:TextBox class="cls" ID="txtFullName" runat="server" Width="98%"></asp:TextBox>
                        </td>
                        <td width="150px">
                            <asp:TextBox class="cls" ID="txtInvoicingName" runat="server" Width="98%"></asp:TextBox>
                        </td>
                        <td width="150px">
                            <asp:TextBox class="cls" ID="txtAdd" runat="server" Width="98%"></asp:TextBox>
                        </td>
                        <td width="150px">
                            <asp:TextBox class="cls" ID="txtMST" runat="server" Width="98%"></asp:TextBox>
                        </td>
                        <td width="150px">
                            <asp:TextBox class="cls" ID="txtNote" runat="server" Width="98%"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="10">
                            <asp:Label ID="lblError" runat="server"></asp:Label>
                        </td>
                    </tr>
                </table>
                <table class="paramlist admintable" width="100%">
                    <tr>
                        <td colspan="2">
                            <asp:Button class="button" ID="btnSave" runat="server" TabIndex="2" Text="Cập nhật"
                                OnClick="btnSave_Click" />
                        </td>
                    </tr>
                </table>
                <%} %>
                <div class="content-box-header">
                    <h3 style="cursor: s-resize;">
                        TRUCKER</h3>
                    <asp:DropDownList ID="ddLocationSearch" Style="margin: 6px;" runat="server" AutoPostBack="true"
                        OnSelectedIndexChanged="ddLocationSearch_SelectedIndexChanged">
                    </asp:DropDownList>
                    <div class="clear">
                    </div>
                </div>
                <%=strAlphaBet%>
                <fieldset>
                    <asp:Repeater ID="rptData" runat="server">
                        <ItemTemplate>
                            <tr onmouseover="this.style.background='#dbf0c9'" onmouseout="this.style.background='#ffffff'">
                                <td align="center">
                                    <%# DataBinder.Eval(Container.DataItem, "Index")%>
                                </td>
                                <td>
                                    <%# DataBinder.Eval(Container.DataItem, "BizName") %>
                                </td>
                                <td code="LocationName">
                                    <%# DataBinder.Eval(Container.DataItem, "LocationName") %>
                                </td>
                                <td>
                                    <%# DataBinder.Eval(Container.DataItem, "FullName") %>
                                </td>
                                <td>
                                    <%# DataBinder.Eval(Container.DataItem, "InvoicingName") %>
                                </td>
                                <td>
                                    <%# DataBinder.Eval(Container.DataItem, "Address") %>
                                </td>
                                <td>
                                    <%# DataBinder.Eval(Container.DataItem, "MST") %>
                                </td>
                                <td>
                                    <%# DataBinder.Eval(Container.DataItem, "Note") %>
                                </td>
                                <%if ((Session["Trucker"] != null) && (int.Parse(Session["Trucker"].ToString()) >= 3))
                                      {%>
                                <td align="center">
                                    <%# DataBinder.Eval(Container.DataItem, "Action") %>
                                </td>
                                <%} %>
                            </tr>
                        </ItemTemplate>
                        <HeaderTemplate>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0" class="adminlist">
                                <thead>
                                    <tr style="background: #CCC;">
                                        <th align="center" width="50px">
                                            STT
                                        </th>
                                        <th align="center">
                                            Biz Name
                                        </th>
                                        <th align="center" width="100px">
                                            Location
                                        </th>
                                        <th align="center">
                                            Full Name
                                        </th>
                                        <th align="center">
                                            Invoicing Name
                                        </th>
                                        <th align="center">
                                            Add
                                        </th>
                                        <th align="center">
                                            MST
                                        </th>
                                        <th align="center">
                                            Note
                                        </th>
                                        <%if ((Session["Trucker"] != null) && (int.Parse(Session["Trucker"].ToString()) >= 3))
                                              {%>
                                        <th align="center" width="125px">
                                            Action
                                        </th>
                                        <%} %>
                                    </tr>
                                </thead>
                        </HeaderTemplate>
                        <FooterTemplate>
                            </TABLE>
                        </FooterTemplate>
                    </asp:Repeater>
                </fieldset>
                <div class="clear">
                </div>
                <div id="footer">
                    <%=strPager%>
                </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
